﻿<Controls:MetroWindow xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" 
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:Custom="http://metro.mahapps.com/winfx/xaml/controls" 
        x:Class="EmailClient.View.EmailAccountView"
        xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
        xmlns:UserControls="clr-namespace:EmailClient.UserControls"
        Height="400" Width="480"
        EnableDWMDropShadow="True"
        ResizeMode="CanResizeWithGrip"
        WindowTransitionsEnabled="False"
        WindowStartupLocation="CenterScreen">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <Menu Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="3">
            <MenuItem x:Name="miSave" Header="{DynamicResource NameButtonSave}" Click="btSave_Click"/>
            <MenuItem x:Name="miDel" Header="{DynamicResource NameButtonDelete}" Click="btDel_Click"/>
            <!--<MenuItem x:Name="miClose" Header="{DynamicResource NameButtonClose}" Click="btClose_Click"/>-->
        </Menu>
        <TabControl Grid.Column="0" Grid.Row="1">
            <TabItem Header="{DynamicResource EmailAccountTabItem1}">
                <StackPanel Orientation="Vertical">
                    <TextBlock Text ="{DynamicResource EmailAccountName}"/>
                    <TextBox x:Name="tbName" Text="{Binding Path=Name, UpdateSourceTrigger=PropertyChanged}" Margin="0,0,0,5" />

                    <TextBlock>Email:</TextBlock>
                    <TextBox x:Name="tbEmail" Text="{Binding Path=Email, 
                        ValidatesOnDataErrors=True,
                        UpdateSourceTrigger=PropertyChanged,
                        NotifyOnValidationError=True}" Margin="0,0,0,5"/>

                    <TextBlock Text ="{DynamicResource EmailAccountSignature}"/>
                    <xctk:RichTextBox x:Name="rtbSignature" MinHeight="191" Margin="2" >
                        <xctk:RichTextBoxFormatBarManager.FormatBar>
                            <xctk:RichTextBoxFormatBar />
                        </xctk:RichTextBoxFormatBarManager.FormatBar>
                        <xctk:RichTextBox.TextFormatter>
                            <xctk:RtfFormatter />
                        </xctk:RichTextBox.TextFormatter>
                    </xctk:RichTextBox>
                </StackPanel>
            </TabItem>

            <TabItem Header="{DynamicResource EmailAccountTabItem2}">
                <StackPanel Orientation="Vertical">
                    <UserControls:TypeMailServer x:Name="ucTypeServer" cbType_Change="ucTypeServer_cbType_Change"/>
                    <UserControls:ServerParametrs x:Name="ucInData" Margin="0,10,0,0"/>
                    <UserControls:ServerParametrs x:Name="ucOutDate" Margin="0,10,0,20"/>
                    <TextBlock Text="{DynamicResource EmailAccountUser}"/>
                    <TextBox x:Name="tbUser" Text="{Binding Path=UserName, UpdateSourceTrigger=PropertyChanged}" Margin="0,0,0,5" />

                    <TextBlock Text="{DynamicResource EmailAccountPassword}"/>
                    <PasswordBox x:Name="pbPass"/>

                    <!--<CheckBox x:Name="chGetLetter" 
                              Content="Забирать письма с сервера" 
                              IsChecked="{Binding Path=GetLetterFromServer, UpdateSourceTrigger=PropertyChanged}" 
                              Margin="0,10,0,0"/>-->
                    <!--<CheckBox x:Name="chUseSameUser" 
                              Content="При отправке использовать тот же логин и пароль." 
                              IsChecked="{Binding Path=UseSameUserPassSending, UpdateSourceTrigger=PropertyChanged}" 
                              Margin="0,10,0,0"/>-->
                    <Button x:Name="btCheck" Content="{DynamicResource EmailAccountCheckSettings}" Height="27" Margin="0,10,0,0" Click="btCheck_Click"/>
                </StackPanel>
            </TabItem>
        </TabControl>              
    </Grid>
</Controls:MetroWindow>
